package com.gamex.findit.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.gamex.findit.dao.NoticeMapper;
import com.gamex.findit.model.Notice;
import com.gamex.findit.service.NoticeService;

/**
 * 알림 서비스
 * @author james
 *
 */
@Service
public class NoticeServiceImpl implements NoticeService{
	private static final Logger logger = LoggerFactory.getLogger(NoticeServiceImpl.class);
	
	@Autowired NoticeMapper noticeMapper;
	
	@Override
	public List<Notice> getNotice(Notice notice) {
		List<Notice> notices = null;
		try {
			notices = noticeMapper.selectNotice(notice);
		} catch (Exception e) {
			logger.error(e.getMessage());
		}
		return notices;
	}

	@Override
	public int getNoticeCount(Notice notice) {
		int count = 0;
		try {
			count = noticeMapper.selectNoticeCount(notice);
		} catch (Exception e) {
			logger.error(e.getMessage());
		}
		return count;
	}

	@Override
	public Notice getNoticeView(int nId) {
		Notice notice = null;
		try {
			notice = noticeMapper.selectNoticeView(nId);
		} catch (Exception e) {
			logger.error(e.getMessage());
		}
		return notice;
	}

	@Override
	public int insertNotice(Notice Notice) {
		int result = 0 ;
		try {
			result =noticeMapper.insertNotice(Notice);
		} catch (Exception e) {
			logger.error(e.getMessage());
		}
		return result;
	}

	@Override
	public void updateNotice(Notice Notice) {
		try {
			noticeMapper.updateNotice(Notice);
		} catch (Exception e) {
			logger.error(e.getMessage());
		}
		
	}

	@Override
	public void deleteNotice(int nId) {
		try {
			noticeMapper.deleteNotice(nId);
		} catch (Exception e) {
			logger.error(e.getMessage());
		}
		
	}

}
